<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
    return 'Hello, Welcome to LaravelAcademy.org';
});
Route::get('user/{id}', function ($id) {
    // id 必须是数字
})->where('id', '[0-9]+');
Route::get('product/{id}', function ($id) {
    // 只有当 {id} 是数字时才会被调用
});
// 显示创建博客文章表单...
Route::get('post/create', 'PostController@create');
// 存储新的博客文章...
Route::post('post', 'PostController@store');
//用户中心
Route::get("user","Mobile\UserController@index");
//后台路由
Route::group(['prefix'=>'admin','namespace'=>'Admin'],function () {
    Route::get("welcome",function(){
        return view("admin.welcome");
    });
    Route::any("login","LoginController@login")->name('login');
    Route::get("logout","LoginController@logout");

    Route::group(['middleware'=>['auth:admins','token']],function () {
        Route::get("/","IndexController@index");
        //管理员管理
        Route::resource("admins","AdminsController");
        Route::get("getadmins","AdminsController@getadmins");
        //用户管理
        Route::resource("user","UserController");
        Route::get("getusers","UserController@get_users");
        Route::post("e_type","UserController@e_type");
        //角色管理
        Route::resource("roles","RolesController");
        Route::get("getroles","RolesController@getroles");
        //权限管理
        Route::resource("permissions","PermissionsController");
        Route::get("getpermissions","PermissionsController@getpermissions");
        //栏目管理
        Route::resource("column","ColumnController");
        Route::get("getcolumn","ColumnController@getcolumn");
        //工资栏目管理
        Route::resource("wages","WagesController");
        Route::get("getwages","WagesController@getwages");
        Route::post("wages/shenhe","WagesController@shenhe");//工资审核
        Route::post("wages/shenhe_all","WagesController@shenhe_all");//审核选中工资
        //工资明细
        Route::get("wagedetails","WagedetailsController@index");
        Route::get("get_wages_all","WagedetailsController@get_wages_all");
        Route::get("yilingqu","WagedetailsController@yilingqu");
        Route::get("get_yilingqu","WagedetailsController@get_yilingqu");
        Route::get("weilingqu","WagedetailsController@weilingqu");
        Route::get("get_weilingqu","WagedetailsController@get_weilingqu");
    });
});
//前台路由
Route::group(['namespace'=>'Mobile'],function(){
    Route::any("login","LoginController@login")->name('login');
    Route::get("logout","LoginController@logout");
    Route::post("sms","LoginController@sms");
//    Route::group(['middleware'=>['auth:users','mobile_token']],function(){
        Route::get("user","UserController@index");
//    });
});
